<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/taglib/struts-tiles.tld" prefix="tiles"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/jsp/stylesheets/style_production.css" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/jsp/js/jquery-1.5.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(
			function() {
				//что бы hover работал и в IE
				$('#main_menu ul li').hover(
						function() {
							$postfx = "center";
							if ($(this).attr('class') == "first") {
								$postfx = "top";
							} else if ($(this).attr('class') == "last") {
								$postfx = "bottom";
							}
							$(this).css(
									"background",
									"url('${pageContext.request.contextPath}/jsp/images/menu_main_"
											+ $postfx + "_hover.png')")
						},
						function() {
							$postfx = "center";
							if ($(this).attr('class') == "first") {
								$postfx = "top";
							} else if ($(this).attr('class') == "last") {
								$postfx = "bottom";
							}
							$(this).css(
									"background",
									"url('${pageContext.request.contextPath}/jsp/images/menu_main_"
											+ $postfx + ".png')")
						});

				//количество сообщений и заданий
				 updateNewMessage(); 
				 updateNewTasks();
				 setInterval(loader, 60000);

			});
	function updateNewMessage() {
		$.ajax({
			type : 'POST',
			url : '/SCS_BSU/message.do',
			data : 'method=notReadMessages',
			success : function(data) {
				$(".circle_blue span").html($.trim(data));

			},
			error : function(error) {
				alert("В результате выполнения ajax-запроса произошла ошибка");
			}
		});
	}
	function updateNewTasks(){
		$.ajax({
			type : 'POST',
			url : '/SCS_BSU/instructor/task.do',
			data : 'method=countUncheckedTasks',
			success : function(data) {
				$(".circle_blue span").html($.trim(data));

			},
			error : function(error) {
				alert("В результате выполнения ajax-запроса произошла ошибка");
			}
		});
	}
	function loader(){
		updateNewMessage();
		updateNewTasks();
    }
</script>
<title><tiles:getAsString name="title" ignore="true" /></title>
</head>
<body id="main_pane">
<div id="container"><tiles:insert attribute="header" />
<div class="notification_zone"></div>
<tiles:insert attribute="menu" /> <tiles:insert attribute="body" />
<div class="cleaner"></div>
<div class="notification_zone"></div>
<tiles:insert attribute="footer" /></div>
</body>
</html>
